package com.yc.videocache;

/**
 * Cache for proxy.
 */

/**
 * Cache
 *
 * @since 2021-05-10
 */
public interface Cache {
    /**
     * available
     *
     * @return null
     * @throws ProxyCacheException
     */
    long available() throws ProxyCacheException;

    /**
     * read
     *
     * @param buffer
     * @param offset
     * @param length
     * @return null
     * @throws ProxyCacheException
     */
    int read(byte[] buffer, long offset, int length) throws ProxyCacheException;

    /**
     * append
     *
     * @param data
     * @param length
     * @throws ProxyCacheException
     */
    void append(byte[] data, int length) throws ProxyCacheException;

    /**
     * close
     *
     * @throws ProxyCacheException
     */
    void close() throws ProxyCacheException;

    /**
     * complete
     *
     * @throws ProxyCacheException
     */
    void complete() throws ProxyCacheException;

    /**
     * isCompleted
     *
     * @return null
     */
    boolean isCompleted();
}
